#Target name of the bin
TARGET = stein

#Name of the compilator
CC = gcc

#Flags to give to the compilator
CFLAG = -g -ggdb -Wall -W -Werror -pedantic -std=c89

#Flags for the library includes
LFLAG =

#Directory of the doxygen file(s)
DOXY = ./Doxyfile

#List of all the project files in the order of dependency
FILES= dunHeap.c dunQueue.c dunLexer.c dunLoader.c dunGraphs.c dunCommandParser.c dunParser.c main.c

OBJS = ${FILES:.c=.o}

#builds the final target binary
${TARGET}: ${OBJS}
	${CC} -o ${TARGET} ${OBJS} ${CFLAG} ${LFLAG}

#Builds the .o files from all the .c
%.o: %.c
	clear
	$(CC) ${CFLAG} ${LFLAG} -o $@ -c $<

all: ${TARGET}

#Generates the conf file for doxygen
docconf:
	mkdir ${DOXY}
	doxygen -g ${DOXY}/conf

#Runs doxygen
doc:
	doxygen ${DOXY}


.PHONY: clean docclean  superclean

#Remove all the object and binary files
clean:
	rm -rf ${TARGET} *.o

#Remove all the documentation files generated by Doxygen
docclean:
	rm -rf html latex

#Clean the current dir and recursivly on all project dirs
superclean: clean docclean
	find . -name "*.o"	-delete
	find . -name "*~"	-delete
	find . -name "#*#"	-delete
	
test:
	make all
	time ./stein dun_test.dj < test_graph
	
dijkstra:
	make all
	./stein dijkstra.dj < test_dijkstra
	
super:
	make all
	time ./stein super_dun1.dj < super_test
	
super2:
	make all
	time ./stein super_dun2.dj < super_test2
	